<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Vue Radio Group with Custom Checkmark</title>
    <style>
        /* 隐藏原生的 radio 输入框 */
        .radio-input {
            display: none;
        }

        /* 自定义的 radio 外观 */
        .radio-label {
            display: inline-block;
            position: relative;
            padding-left: 25px; /* 留出空间放置对号 */
            cursor: pointer;
            line-height: 20px; /* 使标签与对号垂直居中 */
        }

        /* 对号的样式 */
        .radio-label::before {
            content: '';
            position: absolute;
            left: 0;
            top: 0;
            width: 20px;
            height: 20px;
            border: 1px solid #000;
            border-radius: 50%;
            background-color: #fff;
        }

        /* 选中时的样式 */
        .radio-input:checked + .radio-label::before {
            content: "✔";
            font-size: 14px;
            text-align: center;
            line-height: 20px;
            color: red; /* 对号的颜色 */
        }
    </style>
</head>
<body>
<div id="app">
    <label v-for="(item, index) in items" :key="index" class="radio-label">
        <input type="radio" :value="item.value" class="radio-input" v-model="selectedItem" />
        <span>{{ item.text }}</span>
    </label>
</div>

<script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.js"></script>
<script>
  new Vue({
    el: '#app',
    data: {
      selectedItem: null,
      items: [
        { value: 'option1', text: '选项 1' },
        { value: 'option2', text: '选项 2' },
        { value: 'option3', text: '选项 3' },
      ],
    },
    mounted: function() {
      // 如果需要，可以在初始化时设置默认选中的项
      // 例如：this.selectedItem = this.items[0].value;
    }
  });
</script>
</body>
</html>
